package org.netty.client.config;

import org.netty.client.handler.NettyClientDecoder;
import org.netty.client.handler.NettyClientEncoder;
import org.netty.client.handler.NettyClientHandler;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;

public class CustomizeChannelInit extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel channel) {
        // 自定义解码器
        channel.pipeline().addLast(new NettyClientDecoder());
        // 自定义编码器
        channel.pipeline().addLast(new NettyClientEncoder());
        // 在管道中添加我们自己的接收数据实现方法
        channel.pipeline().addLast(new NettyClientHandler());
    }

}